import 'package:ff_stars/ff_stars.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CommentItem extends StatelessWidget {
  ImageProvider headpicUrl;
  String name;
  double score;
  DateTime dateTime;
  String commentContent;

  CommentItem(this.headpicUrl, this.name, this.score, this.dateTime,
      this.commentContent);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          CircleAvatar(
            radius: 15,
            backgroundImage: headpicUrl,
          ),
          SizedBox(width: 10,),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(name),
                    Text("${dateTime.year}-${dateTime.month}-${dateTime.day}")
                  ],
                ),
                SizedBox(height: 10,),
                FFStars(
                    justShow: true,
                    step: 1,
                    starHeight: 15,
                    starWidth: 15,
                    defaultStars: score,
                    normalStar: Image.asset("images/star_unselected.png"),
                    selectedStar: Image.asset("images/star_selected.png"),starMargin: 2,),
                SizedBox(height: 20,),

                Text("这个陪玩不错")
              ],
            ),
          )
        ],
      ),
    );
  }
}
